package com.hw.springcloud.controller;

import com.hw.springcloud.entity.CommonResult;
import com.hw.springcloud.service.StorageService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Classname: StorageController
 * @Description: 描述
 * @Date: 2021/12/22
 * @Author: HuWei
 */
@RestController
@RequestMapping("/storage")
public class StorageController {

    @Resource
    private StorageService storageService;

    @GetMapping("/updateStorage/{productId}/{userNum}")
    public CommonResult<Boolean> updateStorage(@PathVariable("productId")Long productId,@PathVariable("userNum")Integer userNum){
        Boolean aBoolean = storageService.UpdateStorage(productId, userNum);
        if(aBoolean){
            return new CommonResult<>(200,"修改库存成功", true);
        }
        return new CommonResult<>(500,"修改库存失败", false);
    }
}
